import React, { useEffect, useState } from 'react';
import { connect } from 'dva';
// import styles from './index.less';
import { Row, Col } from 'antd';
import ServiceType from './serviceType';
import BuildType from './buildType';
import Budget from './budget';
import NumberType from './numberType';
import Department from './department';

const Number = ({ data, dispatch }) => {
  const [graph, setgraph] = useState({});
  useEffect(() => {
    dispatch({
      type: '$request/post',
      payload: {
        url: '/api/analysis/v1/moneyAnalysis',
      },
    }).then(res => {
      setgraph(res);
    });
  }, []);
  return (
    <Row style={{ backgroundColor: 'white', padding: 20 }}>
      <Col
        span={12}
        style={{ marginTop: 30, padding: 20, boxShadow: '5px 5px 5px #dedede' }}
      >
        <ServiceType data={graph} />
      </Col>
      <Col
        span={12}
        style={{ marginTop: 30, padding: 20, boxShadow: '5px 5px 5px #dedede' }}
      >
        <BuildType data={graph} />
      </Col>
      <Col
        span={12}
        style={{ marginTop: 30, padding: 20, boxShadow: '5px 5px 5px #dedede' }}
      >
        <NumberType data={graph} />
      </Col>
      <Col
        span={12}
        style={{ marginTop: 30, padding: 20, boxShadow: '5px 5px 5px #dedede' }}
      >
        <Budget data={graph} />
      </Col>
      <Col
        span={24}
        style={{ marginTop: 30, padding: 20, boxShadow: '5px 5px 5px #dedede' }}
      >
        <Department data={graph} />
      </Col>
    </Row>
  );
};
export default connect(state => state['namespace'])(Number);
